﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

using System.Configuration;
using System.Data;


using RTGS.Web;
using RTGS.Web.support;

using RTGS.Library.DataAccess;


using RTGS.Library.DataAccess.UserManagement;
using RTGS.Library.Entities.UserManagement;

namespace RTGS.Web.form.usermanagement
{
    public partial class sys_t_userform : BasePage
    {
        private int id = -1;

        private sysTUserRepo userDal = new sysTUserRepo(ConfigurationManager.ConnectionStrings["Rtgs"].ConnectionString);

        protected void Page_Load(object sender, EventArgs e)
        {

            if (Request.Params["Id"] != null)
            {
                id = Convert.ToInt32(Request.Params["Id"]);
            }


            if (!Page.IsPostBack)
            {

                if (id > 0) // Edit an existing item
                {
                    sysTUser dto = userDal.GetById(id);
                    if (dto != null)
                    {
                        hfID.Value = id.ToString();
                        txtUserName.Text = dto.userName;
                        txtEmail.Text = dto.email;
                        txtMobile.Text = dto.mobile;
                        chkIsActive.Checked = dto.isactive.HasValue ? dto.isactive.Value : false;
                        trPassword.Visible = false;
                        txtExpiredDays.Text = dto.expiredDays.ToString();
                        chkIsLock.Checked = dto.isactive.HasValue ? dto.islock.Value : false;
                    }
                }
            }

        }

        protected void ddlEselon_SelectedIndexChanged(object sender, EventArgs e)
        {
           
        }

        protected void ddlWilayah_SelectedIndexChanged(object sender, EventArgs e)
        {
            
        }

        protected void ddlSatker_SelectedIndexChanged(object sender, EventArgs e)
        {
           
        }


    }
}

